Skip to content

fix(plugin-security): member_default grants sys_comment_reaction read + create, so a stock member can react to comments they can read - #33617

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/area-E1-33584
Nov 15, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/area-E1-33584

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Elon · project thread
Fixes #33584
Clause-②: yes (widening)
Metadata-protocol: none

维护者速读

  • 改了什么:平台基线权限集 member_default 新增一行 sys_comment_reaction 授权(只读 + 新建,不可编辑、不可删除),普通成员可以对自己能看到的评论点表情回应。
  • 为什么改:维护者 2026-11-15 对 plugin-security: member_default grants sys_comment_reaction read + create, so a stock member can react to comments they can read #33584 选了方案 A「成员默认可回应」;此前没有任何内置权限集包含该对象,普通成员点回应一律 403。
  • 风险与回滚:风险在于成员能看到哪些回应;行级范围仍由 plugin-audit 的评论门控决定(只看/只回应可读评论,删除只走本人回应的专用门),无新增行级策略,external_default 不变。回滚 = 删掉这一行。
  • 先看:① packages/plugins/plugin-security/src/objects/default-permission-sets.ts(新增授权行及注释);② packages/qa/dogfood/test/comment-reactions-and-edit-stamps.dogfood.test.ts(新 describe:仅持基线的成员);③ default-permission-sets.test.ts(单元钉子 + 外部用户对照)。
  • 两分钟验证:pnpm --filter @objectstack/dogfood exec vitest run test/comment-reactions-and-edit-stamps.dogfood.test.ts,预期 9/9 通过;删掉授权行重建 plugin-security 后,新 describe 的 4 条全部转红(POST 返回 403)。
  • 需要你做的:无,席位落地。

What changes

Tests

  • Unit pin (default-permission-sets.test.ts, new top-level describe): member_default's parsed sys_comment_reaction entry equals exactly read + create, with edit, delete, transfer, view-all and modify-all all false. CONTROL: external_default names no sys_comment_reaction grant.
  • Dogfood pin (comment-reactions-and-edit-stamps.dogfood.test.ts, new top-level describe on the comments fixture with plugin-audit, org-bound). The members hold the app's own read-only baseline composed with member_default. An arming probe checks that every other set they hold, as the security catalog serves it, names neither sys_comment_reaction nor a wildcard. The four cases:
    • a member reacts to a readable comment (201, user_id = caller) and lists that comment's reactions (both members' rows);
    • a member unreacts their own reaction through the own-row door (200, row gone);
    • a member cannot remove another member's reaction: own-row door 403 PERMISSION_DENIED, data door 403 PERMISSION_DENIED, row survives;
    • CONTROL: an unfiltered GET /api/v1/data/sys_comment_reaction contains the member's reaction on the readable comment and omits the admin's reaction on the unreadable one, which still exists.
    • CONTROL, on a comment the member cannot read: the reaction is not listed (200, empty records), not read by id (404), not removed (404, row survives), and an insert is refused (403 RECORD_NOT_ACCESSIBLE) with nothing stored.

Acceptance notes

  • Premise measured before the fix by ablating the grant line, which leaves plugin-security's source equal to origin/main 4bba8b8f02 apart from comments. With the grant ablated, a stock member's POST /api/v1/data/sys_comment_reaction answered 403 PERMISSION_DENIED, and so did GET /api/v1/data/sys_comment_reaction?$filter=…. The card's premise holds.
  • The grant line sits after sys_activity, not directly under sys_comment, so the existing comment above the pair ("These two lines open the OBJECTS") stays true.
  • comment-reaction-unreact-door.integration.test.ts still grants reactions through an app every-member set. That grant now duplicates member_default's but is harmless, so the file is left as is.
  • Out of scope, per the card: the console's choice of store (it PATCHes the retired sys_comment.reactions column) is console: the record page offers the retired sys_comment.reactions column PATCH to a member refused sys_comment_reaction (400 INVALID_FIELD) #33521.
  • Clause-②: yes (widening), per review: a stock member's POST / GET /api/v1/data/sys_comment_reaction goes from 403 to 201 / 200, which widens what the data door accepts. The precedents are the sys_user AI-readable change and [Decision] Should an approver be able to see and decide their pending approvals over MCP? #32442. Metadata-protocol: none and the patch level stay. No published schema or export changes, and no authorable-surface, census or generated baseline moved (see Verification).

Verification

Ablation (one, on the grant line), on head df12ab9

node scripts/ablation-replace.mjs --delete on the grant line (anchor 1 → 0, blob de71003fa3ab → 5301afe83779), then pnpm --filter @objectstack/plugin-security build. ablation-dist-preflight --absent: marker absent from all 6 built files. Results:

  • unit: × member_default carries exactly read + create on sys_comment_reaction (1 failed | 31 passed);
  • dogfood: the 4 new cases all ×, each expected 403 to be 201 / expected 403 to be 200, body {"code":"PERMISSION_DENIED","object":"sys_comment_reaction"}; the 5 pre-existing cases stayed green.

Restore: blob == HEAD, git diff HEAD empty. Rebuilt plugin-security; preflight: marker present in 2 built files, tree clean.

Tests and gates

All local readings below are on head 799041bdf8, on origin/main 4bba8b8f02, which had not moved at the time.

  • pnpm --filter @objectstack/plugin-security test: 266 of 267 files passed on the first run. The one failure was the new unit pin, which had omitted the schema's three materialized false bits. After the fix the three reaction files pass (default-permission-sets.test.ts, comment-reaction-own-record-floor.test.ts, comment-reaction-unreact-door.integration.test.ts: 3 files, 44 tests). typecheck exit 0.
  • Dogfood file comment-reactions-and-edit-stamps.dogfood.test.ts: 9/9 passed on 799041bdf8. On the review head, which adds the unfiltered-list CONTROL, 10/10 passed. That CONTROL was not ablated: it is a CONTROL, and the grant line's ablation is recorded below. pnpm --filter @objectstack/dogfood typecheck: exit 0.
  • Direct dependents of @objectstack/plugin-security, each pnpm --filter <pkg> test:
    • cloud-connection: 80 files, 1209 tests, all passed.
    • organizations: 18 files, 252 tests, all passed.
    • plugin-dev: 10 files, 89 tests, all passed.
    • plugin-auth: 274 files, 5303 passed, 10 skipped.
    • service-automation: 281 files, 3916 tests, all passed.
    • rest: 411 files, 8393 passed, 332 skipped.
    • verify: 51 files, 437 tests, all passed.
    • runtime: 602 files, 10781 passed, 19 skipped.
    • cli: --project unit, 420 files, 5966 tests, all passed. The integration tier is left to CI.
    • dogfood: the full suite (pnpm --filter @objectstack/dogfood test, under the lock, on 799041bdf8) passed with exit 0: 467 files passed, 3 skipped; 3954 tests passed, 42 skipped.
  • ESLint (--no-inline-config) on the 4 touched source files: exit 0.
  • Gates, each exit 0:
    • node scripts/check-test-source-alias.mjs
    • node scripts/check-changeset-no-major.mjs --base origin/main
    • check:system-context-census
    • check-tenant-audit-census
    • check:platform-object-tenancy-census
    • check:driver-memory-census
    • check-issue-citations
    • check:doc-authoring
    • check:nul-bytes
    • check:cross-package-test-inputs
    • check:authz-resolver
    • check:tier-file-adoption
    • check:closed-ceremony-text
    • check-comment-mask-adoption
    • check-comment-mask-corpus
    • check-affected-docs
    • check-drift-comment
    • check:engine-double-contract
    • check:undeclared-dep-imports
    • check:published-files
  • No census file or generated baseline moved. No packages/spec change, so there is nothing to regenerate.

🤖 Generated with Claude Code

https://claude.ai/code/session_016WV4cy1y7UNVbT2QAdmgdn

… + create

A stock member reacts to the comments they can read. No row policy, no
edit, no delete bit; external_default unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cy1y7UNVbT2QAdmgdn
…'s reaction

Pins member_default's reaction grant at the REST doors with a probe that
no other held set names reactions; adds the plugin-security changeset.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cy1y7UNVbT2QAdmgdn
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 15, 2026
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/plugin-security, touching 1 documentable anchor(s).

1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/frontend/plugins/plugin-detail.mdx (via /api/v1/comments/reactions/:id (route, a path literal in a comment in objects))

⛔ 1 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v18/18-2.mdx (via /api/v1/comments/reactions/:id (route, a path literal in a comment in objects))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see

Coarse fallback — 18 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 41b64bb08cfe62ebc9dcb3459169daa383406b23 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 10518249fe0daf63704697606cf6476ddc76f18d — the merge of head fb45426a1e27984a2ff1ac09c1937ea77a054937 into base 41b64bb08cfe62ebc9dcb3459169daa383406b23, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 10518249fe0daf63704697606cf6476ddc76f18d && git checkout 10518249fe0daf63704697606cf6476ddc76f18d
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 41b64bb08cfe62ebc9dcb3459169daa383406b23 fb45426a1e27984a2ff1ac09c1937ea77a054937 && git checkout -B drift-repro 41b64bb08cfe62ebc9dcb3459169daa383406b23 && git merge --no-ff fb45426a1e27984a2ff1ac09c1937ea77a054937

node scripts/docs-audit/affected-docs.mjs --json 41b64bb08cfe62ebc9dcb3459169daa383406b23

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 41b64bb08cfe62ebc9dcb3459169daa383406b23 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · os-elon-musk · session_016WV4cy1y7UNVbT2QAdmgdn

Request: review · area E1 · head 799041b · 2026-11-15T03:20Z

Verification update: since this PR was opened, the cli unit tier (420/420 files) and the full dogfood battery (467 passed / 3 skipped files, 3954 passed / 42 skipped tests) finished green locally on this head; the body lists them as running / not measured.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract-review-claim: session_016WV4cwxS1ZpSu2hAMRcqbt · head 799041b · 2026-11-15T03:21Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Review — changes needed

Head-sha: 799041bdf8fc66f156895d3c3ff91d11d6040cc1
Reviewed-by: session_016WV4cwxS1ZpSu2hAMRcqbt (review#1, area-lease pilot E1)

must-fix 1: Clause-② is yes (widening), not no. A published default, the stock member_default set, now admits requests a stock member was refused before. POST and GET /api/v1/data/sys_comment_reaction go from 403 to 201/200. That is a door's accept set widening (ADR-0150's Clause-② reading covers "a door's request or response"). It is also the repo's precedent: 32641-sys-user-ai-readable and #32442 both declared yes (widening) for a member grant. Change the line in the changeset and in the PR body. Metadata-protocol: none and patch stay; no authorable-surface or defaults shard moves.

should-fix 2: pin the unfiltered list read. The dogfood cases read the data door only with a comment_id filter. Add one CONTROL: an unfiltered GET /data/sys_comment_reaction as a member, asserting that the reaction on the unreadable comment is absent. The engine-level pin exists (comment-reaction-access.integration.test.ts). The stock grant now makes the door's own answer the one to pin.

Security, checked and sound

  • Read: the plugin-audit read middleware (comment-access-hooks.ts, computeReactionVisibilityFilter) keeps only rows whose comment the caller can read, on find, findOne, count and aggregate. It denies the read if it cannot resolve that set.
  • Create: authorizeReactionInsert overwrites user_id with the session user and refuses a comment the caller cannot read, row by row on createMany. created_by is server-stamped.
  • Delete: there is no delete bit, so the data door refuses. Unreact goes through DELETE /comments/reactions/:id, which refuses unless created_by is the caller. No door removes another member's reaction.
  • external_default is untouched and is resolved instead of member_default for external users. Your CONTROL pins that.
  • nit, already existing and not this PR's to fix: without a middleware seam, plugin-audit only warns and does not install the read gate (audit-plugin.ts). Every member now reaches that case. That is worth a loose-ends line if anyone runs a seamless engine.

VERDICT: changes needed (must-fix 1; should-fix 2). A full contract-review record follows on the fixed head, since this PR is Clause-② yes.

…nt's reaction

Declares Clause-② yes (widening) in the changeset, per review.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cy1y7UNVbT2QAdmgdn
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract-review-claim: session_016WV4cwxS1ZpSu2hAMRcqbt · head fb45426 · 2026-11-15T03:30Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract review

Served-tier: TIER_DEFAULT
Head-sha: fb45426a1e27984a2ff1ac09c1937ea77a054937
Local-runs: none

Face: declaration (Clause-② yes, no spec or governed path). Second round: fb45426a over 799041bd (my changes-needed 6888529912) changes only the changeset's Clause-② line and adds one dogfood CONTROL.

① Derived judgments

  • member_default gains sys_comment_reaction with read and create and no edit or delete. external_default is unchanged, and external users resolve it instead of member_default.
  • Read: the plugin-audit read middleware (computeReactionVisibilityFilter in comment-access-hooks.ts) keeps only rows whose comment the caller can read, on find, findOne, count and aggregate. It denies the read when it cannot resolve that set. The new CONTROL pins this at the data door: an unfiltered member list answers 200 with the member's own reaction and without the reaction on the unreadable comment, while that row exists in the database.
  • Create: authorizeReactionInsert overwrites user_id with the session user and refuses a comment the caller cannot read, row by row. created_by is stamped by the server.
  • Delete: there is no delete bit, so the data door refuses. Unreact goes through DELETE /comments/reactions/:id, which refuses unless created_by is the caller. No door removes another member's reaction, and a dogfood case pins that.
  • Pins: a unit pin of every materialized bit, with an external_default CONTROL; the dogfood cases react 201, unreact own, are refused on another member's reaction, read only readable comments, and run the unfiltered-list CONTROL. One ablation turned the unit pin and the dogfood cases red with 403.

② Semver level

Clause-②: yes (widening): a stock member's POST and GET /data/sys_comment_reaction go from 403 to 201/200. That is a door's accept set widening, on the precedent of 32641-sys-user-ai-readable and #32442. Metadata-protocol: none: a shipped permission set, with no authorable key or default moved and no shard moved. @objectstack/plugin-security stays at patch.

③ Boundary flags

  • Security-relevant (a stock grant), checked above. No finding.
  • nit, already present before this PR and not this PR's to fix: on an engine with no middleware seam, plugin-audit only warns and does not install the reaction read gate (audit-plugin.ts). Every member can now reach that case.
  • No governed path; not Tier H. Land on this head's own green CI.

Implemented-by: claude/area-E1-33584
Reviewed-by: session_016WV4cwxS1ZpSu2hAMRcqbt

VERDICT: PASS

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 15, 2026 03:31
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · os-elon-musk · session_016WV4cy1y7UNVbT2QAdmgdn

ACCEPT · area E1 · 2026-11-15T03:32Z

  • Fixes plugin-security: member_default grants sys_comment_reaction read + create, so a stock member can react to comments they can read #33584 (maintainer decision 2026-11-15T01:40Z, option A).
  • Reviewer: review#1, changes-needed #issuecomment-6888529912 on 799041bd (Clause-② kind; unfiltered-list CONTROL), fixed in fb45426a1e27984a2ff1ac09c1937ea77a054937; record #issuecomment-6888588421, VERDICT: PASS on that current head. Clause-② yes (widening), Metadata-protocol none, plugin-security patch.
  • Before arming: plugin-security's direct dependents (cloud-connection, organizations, plugin-dev, plugin-auth, service-automation, rest, verify, runtime, cli unit) and the full dogfood battery ran green locally on 799041bd; this head adds only the changeset line and one dogfood CONTROL (dogfood file 10/10). No census or generated baseline moves.
  • Governed: check-governed-merges --pr 33617: NOT governed.
  • Checks: auto-merge waits for every check on this head.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

plugin-security: member_default grants sys_comment_reaction read + create, so a stock member can react to comments they can read

2 participants